package cn.wizzer.framework.util;

import org.nutz.mvc.ActionContext;

public class TLManager {
    private static ThreadLocal<ActionContext> threadLocal = new ThreadLocal();

    public static void set(ActionContext result) {
        threadLocal.set(result);
    }

    public static Throwable getError() {
        if (threadLocal.get() != null) {
            return threadLocal.get().getError();
        }
        return null;
    }

    public static ActionContext get() {
        return threadLocal.get();
    }

    public static void close() {
        threadLocal.remove();
    }
}
